﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Game1942.Library
{
	public class TurnManager
	{
		private int speed;
		private int rate;

		private int speedCounter;
		private int rateCounter;
		
		
		public bool AllowShoot()
		{
			// Returns true if it's your turn to shoot
			if( rateCounter == (/*Constants.MaxRate -*/ rate) ) 
            {
				rateCounter = 0;
				return true;
			}
            return false;
			
		}
		
		public bool AllowMove()
		{
		    // Returns true if it's your turn to move
            if (speedCounter == (/*Constants.MaxSpeed -*/ speed))
            {
				speedCounter = 0;
				return true;
			}
		    return false;
		}

	    public TurnManager (int speedValue, int rateValue)
		{
			if (speedValue < 0 | rateValue < 0)
			{
				throw (new ArgumentException());
			}
			speed = speedValue;
			rate = rateValue;
			
			speedCounter = 0;
			rateCounter = 0;
			
		}

		public TurnManager()
		{
			// If these values are not modified, then you do not move or/and you do not shoot
			speed = 0;
			rate = 0;
			
			speedCounter = 0;
			rateCounter = 0;
			
		}
        public void SetSpeed(int speedValue)
        {
            speed = speedValue;
        }


		public void Next()
		{
			if(rate > 0)
				rateCounter++;
			if(speed > 0)
				speedCounter++;
				
		}
	}
}
